package distribuidos.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import distribuidos.modelo.Sala;


/**
 * Servlet implementation class Menu
 */
@WebServlet("/Menu")
public class Menu extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Menu() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		HttpSession session = request.getSession();
        String tipo=request.getParameter("tipo");
        RequestDispatcher rd;
   
        String mod=request.getParameter("mod");
        
    	if (mod.equals("lisres")){
	        	 rd = request.getRequestDispatcher("listado.jsp");
				 rd.forward(request, response);
	         
		 }else if(mod.equals("salas")){
			 rd = request.getRequestDispatcher("sala.jsp");
			 rd.forward(request, response);
		 }else if(mod.equals("res")){
			 rd = request.getRequestDispatcher("reserva.jsp");
			 rd.forward(request, response);
		 }else if(mod.equals("tipo")){
			 rd = request.getRequestDispatcher("tiposala.jsp");
			 rd.forward(request, response);
		 }else if(mod.equals("lista")){
			 rd = request.getRequestDispatcher("recursos.jsp");
			 rd.forward(request, response);
		 }else if(mod.equals("cerrar")){
			 rd = request.getRequestDispatcher("loguin.jsp");
			 rd.forward(request, response);
		 }
        
		

	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String mod=request.getParameter("mod");
		RequestDispatcher rd;
		
		  if (mod.equals("lista")){
			  rd=request.getRequestDispatcher("recursos.jsp");
			  rd.forward(request, response);  
		  }else if(mod.equals("ingreso")){
			  rd=request.getRequestDispatcher("listado.jsp");
			  rd.forward(request, response); 
		  }
		
	}

}
